<gm:page title="My App" authenticate="false">

 
  <h1>Hello World!</h1>

 
 <!--  DATA FOR TEST  -->


 
<gm:list id="diggFeed" data="http://www.google.com/base/feeds/snippets/-/hike%20reviews/" pagesize="10" template="diggTemplate">
  <gm:handleEvent event="select" execute="changeImgData(event.entry);"/>
</gm:list>
<h2>Imagens</h2>
<gm:list id="imgFeed"  pagesize="10" template="imgTemplate"/>

   
<!-- templates -->
  <gm:template id="diggTemplate">
    <table>
      <tr repeat="true">
        <td><gm:text ref="atom:title"/></td>
        <td><gm:text ref="atom:content"/></td>
      </tr>
    </table>
  </gm:template>

  
<!-- templates -->

  <gm:template id="imgTemplate">
    <table>
      <tr repeat="true">
<!--        <td><gm:image ref="media:thumbnail/@url"/></td> -->
        <td><gm:text ref="atom:title"/><br/>
            <span class=".img-text"><gm:html ref="atom:summary"/></span></td>        
      </tr>
    </table>
  </gm:template>

  
<script>
    var titleGPath = new GPath("atom:title");
    var baseImgURL = "http://api.flickr.com/services/feeds/photos_public.gne?id=22255564@N06&lang=en-us&format=rss_200&tags=";
  
    function changeImgData(entry) {
      if (entry) {
        var urlGPath = new GPath("g:tag");
        var urlString = urlGPath.getValue(entry);
        urlString = baseImgURL + urlString;
        //alert(urlString);
        google.mashups.getObjectById('imgFeed').setData(urlString);
      }
      else {
        google.mashups.getObjectById('imgFeed').setData(null);
      }

    };

    function changeData(entry) {
      if (entry) {
        var urlGPath = new GPath("atom:link[@rel='alternate']/@href");
        var urlString = urlGPath.getValue(entry);
        google.mashups.getObjectById('blogEntryList').setData(urlString);
      }
      else {
        google.mashups.getObjectById('blogEntryList').setData(null);
      }
    }
  
  
    function create() {
      var myListData = google.mashups.getObjectById('myList').getData();
      var entry = myListData.createEntry();
      
      titleGPath.setValue(entry, prompt('Title:', ''));
      myListData.addEntry(entry);
    };

    function read() {
      var myListData = google.mashups.getObjectById('myList').getData();
      var entry = google.mashups.getObjectById('myList').getSelectedEntry();

      if (!entry) { 
        alert('Please select an item.');
        return;
      }

      alert(titleGPath.getValue(entry));
    };

    function update() {
      var myListData = google.mashups.getObjectById('myList').getData();
      var entry = google.mashups.getObjectById('myList').getSelectedEntry();
      
      if (!entry) {
        alert('Please select an item.');
        return;
      }
      
      titleGPath.setValue(entry, prompt('New title:', titleGPath.getValue(entry)));
      myListData.updateEntry(entry);
    };

    function del() {
      var myListData = google.mashups.getObjectById('myList').getData();
      var entry = google.mashups.getObjectById('myList').getSelectedEntry();
      
      if (!entry) {
        alert('Please select an item.');
        return;
      }
      
      myListData.removeEntry(entry);
    };
  </script>  



</gm:page>